package com.bos.web.action;

import com.opensymphony.xwork2.ActionContext;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.*;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import javax.servlet.http.HttpServletRequest;

/**
 * @author misterWei
 * @create 2018年11月13号:11点59分
 * @mailbox mynameisweiyan@gmail.com
 */
@Namespace("/")
@ParentPackage("json-default")
@Controller
@Actions
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class IndexAction {

    @Action(value = "showId",results = {@Result(type = "json")})
    public String showId(){
        HttpServletRequest request = ServletActionContext.getRequest();

        ActionContext.getContext().getValueStack().push(request.getRemoteAddr());
        return "success";
    }
}
